package com.bell.atensettings;

import com.bell.atensettings.settingDetails.DisplayAreaSettings;
import com.bell.atensettings.settingDetails.InputMethodSettings;
import com.bell.atensettings.settingDetails.LocaleSettings;
import com.bell.atensettings.settingDetails.SleepTimeSetting;
import com.bell.atensettings.settingDetails.VoiceSettings;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;

public class FunctionsSettings extends Activity implements OnItemClickListener
{
    private TextView mSettingTitle;
    private ListView mListView;

    @Override
    protected void onCreate(Bundle bundle)
    {
        super.onCreate(bundle);
        setContentView(R.layout.public_settings);

        mSettingTitle = (TextView) findViewById(R.id.setting_title);
        mListView = (ListView) findViewById(R.id.listview);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_subject_item, R.id.tv_data,
                getResources().getStringArray(R.array.function_item));

        mSettingTitle.setText(getIntent().getStringExtra("title"));
        mListView.setAdapter(adapter);
        mListView.setOnItemClickListener(this);
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id)
    {
        Intent intent = null;
        String[] itemStrings = getResources().getStringArray(R.array.function_item);
        
        switch (position)
        {
            case 0://屏幕缩放
                intent = new Intent(this, DisplayAreaSettings.class);
                intent.putExtra("title", itemStrings[position]);
                startActivity(intent);
                break;
            case 1://休眠时间
                intent = new Intent(this, SleepTimeSetting.class);
                intent.putExtra("title", itemStrings[position]);
                startActivity(intent);
                break;
            case 2://语言设置
                intent = new Intent(this, LocaleSettings.class);
                intent.putExtra("title", itemStrings[position]);
                startActivity(intent);
                break;
            case 3://输入法设置
                intent = new Intent(this, InputMethodSettings.class);
                intent.putExtra("title", itemStrings[position]);
                startActivity(intent);
                break;
            case 4://声音设置
                intent = new Intent(this, VoiceSettings.class);
                intent.putExtra("title", itemStrings[position]);
                startActivity(intent);
                break;

            default:
                break;
        }
        overridePendingTransition(R.anim.push_left_in, R.anim.end);
    }
}
